﻿function addDepartment(button)
{
    var bar = $(button.parentNode);
    var idInput = bar.find("input[name=id]");
    var nameInput = bar.find("input[name=name]");
    var src = "/Department/AddDepartment.aspx?parentId="
        +idInput.val() +"&parentName="+nameInput.val();
    $("#detailFrame").attr("src", src);
}

function viewDepartment(node)
{
    var bar = $(node.parentNode).next();
    var idInput = bar.find("input[name=id]");
    var src = "/Department/ViewDepartment.aspx?id="+idInput.val();
    $("#detailFrame").attr("src", src);
}

function editDepartment(button)
{
    var bar = $(button.parentNode);
    var idInput = bar.find("input[name=id]");
    var src = "/Department/EditDepartment.aspx?id="+idInput.val();
    $("#detailFrame").attr("src", src);
}

function removeDepartment(button)
{
    var bar = $(button.parentNode);
    var idInput = bar.find("input[name=id]");
    var src = "/Department/RemoveDepartment.aspx?id="+idInput.val();
    $("#detailFrame").attr("src", src);
}